#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

#define VALID(a, b)	((a) > 0 && (a) < (b) - 1)

static int
empty_adjacent_num(int a[10][10], const int n, const int row, const int col, bool top_lvl)
{
	int i = row, j = col;
	int ans = 0;

	if (top_lvl) {
		do {
			if (VALID(j, n) && a[i][j - 1] == '.')
				j--;
		} while (VALID(j, n) && a[i][j - 1] == '.');
	}

	while (VALID(j, n) && a[i][j] == '.') {
		ans++;
		a[i][j] = 'v';

		if (VALID(i, n) && a[i + 1][j] == '.')
			ans += empty_adjacent_num(a, n, i + 1, j, true);
		if (VALID(i, n) && a[i - 1][j] == '.')
			ans += empty_adjacent_num(a, n, i - 1, j, true);

		j++;
	}

	return ans;
}

int
main(int argc, char **argv)
{
	static int room[10][10];
	int c;
	int n, row, col;
	int i = 0, j = 0;

	scanf("%d", &n);
	while (i < n) {
		j = 0;
		while (j < n) {
			c = fgetc(stdin);
			if (c == '.')
				room[i][j] = '.';
			else if (c == '*')
				room[i][j] = '*';
			else
				continue;
			j++;
		}
		i++;
	}
	scanf("%d%d", &row, &col); row--; col--;

	printf("%d\n", empty_adjacent_num(room, n, row, col, true));

	return 0;
}
